import request from "@/request/request";
import qs from "qs";


// 下面这种写法,他会自己执行,所以把它写成函数返回形式
//export const JingpinApi =  request.get("/products/recommend")

// 精品推荐
export const JingpinApi = () => request.get("/products/recommend")

//? 热门兑换
export const hotApi = () => request.get("/products/hot")

// 商品详情
export const productsApi = (id) => request.get(`/products/${id}`)

// 手机号登录(含注册)
export const phoneReginApi = (params) => request.post('/phoneRegin', qs.stringify(params))

// 验证码
export const sendSMSApi = (params) => request.post('/sendSMS', qs.stringify(params))

// 微信扫码登录
export const weixinLoginApi = (params) => request.post('/wechatUsers/PCLogin', qs.stringify(params))


// 手机绑定微信
export const weixinBindingApi = (params) => request.post('/wechatUsers/binding', qs.stringify(params))

// 微信解绑(登录状态下)
export const unbindingWeChatApi = () => request.put('/wechatUsers/unbindingWeChat')

// 获取用户信息
export const userProfilesApi = () => request.get('/shop/userProfiles')

// 加入到购物车
export const addCartApi = (params) => request.post('/shop/carts/add', qs.stringify(params))

// 查看购物车
export const cartsApi = () => request.get('/shop/carts')

// 购物车删除商品
export const edleteApi = (params) => request.delete(`/shop/carts?productIds=${params.id}`)

// 商品搜索（含首页的'更多'）
export const moreProductsApi = (params) => request.get('/products', {
    params
})